/**************************************************************************

EnRoute Regel-Editor 1.4a9 D  (German Rule Editor)

	// LRT - 97/06/01 5:22 PM
	Changed popup label from "Byten" to "Byte"
	Bug:
		1658262 - Rule generation slip translation problems
		<a>	the size is measured in "Byten" which should be "Byte"

	// LRT - 97/06/01 6:36 PM
	rSubWhen.datePik.viewSetupFormScript
	Modified algorithm for setting default value for "Date" to:
		if value < "1/1/70 12:00 AM" then value := NOW

	// LRT - 97/06/01 6:36 PM
	rSubAge.datePik.viewSetupFormScript
	Modified algorithm for setting default value for "Age" to:
		if val = 0 or val > 30 years then value := 2 days


Message Rules Filter 1.4.1FC3
i-net Regel-Filter 1.4.1FC3

	// LRT - 97/06/01 4:40 PM
	Changed viewBounds AND bounds slot of ruleset picker to standard height
	to prevent debris in view from display of characters with descenders.
	Bug:
		1658279	- Crud left on slip after changing Rule sets

=============================================================================

Message Rules Filter 1.4.1B2

	// LRT - 97/05/03 1:07 AM
	Added code to test "Sender:" info along with "From:" info so that Rules can
	use (see) source addresses generated by mail list servers.
	This corresponds to a modification in the i-net transport 1.4.1B2 which 
	creates the new "txtFrom" slot.

		Modified ruleFns.nh function "kRF_From_GetFn"

			// WAS:
			// if msg.fromRef then
			// NEW:
			if msg.txtFrom then msg.txtFrom
			else if msg.fromRef then

i-net Regel-Filter 1.4.1a11 D

	// LRT - 97/04/23 4:09 AM
	// when loading a rule set, get the soup entry if it's available

EnRoute Regel-Editor 1.4a9 D  (German Rule Editor)

	// LRT - 97/04/22
	Changed German translations:

		"The item currently set as the preference cannot be deleted."
		"Das derzeit in den Einstellungen gewhlte Objekt kann nicht gelscht werden." 

		"Creating"
		"Erstellen"

		"Add Rule"
		"Regel hinzufgen"

		"Criteria"
		"Kriterium"

		"Parameters"
		"Parameter"

		"Result"
		"Ergebnis"

		"Age"
		"Alter"

		"Date"
		"Datum"

		"Size"
		"Gre"


i-net Regel-Filter 1.4.1a9 D

	Updated to keep version numbers in synch

EnRoute Regel-Editor 1.4a9 D  (German Rule Editor)


	// LRT - 97/04/15 9:09 PM
	Removed "autoPutawayEnabled" slot as per request from Apple
	Bug:
		1644952 - item not put away although "Put away automatically" checked


	// LRT - 97/04/15 4:02 PM
	Prevent "DownCase" of nouns when language is German
	Bug:
		1646729 - EnRoute Rule entries should be capitalized correctly


	// LRT - 97/04/15 3:52 PM
	Changed German translations:
		"Absender" to "Absender-Adresse",
		"Empfngeradresse" to "Empfnger-Adresse",
	Bug:
		1646729 (part b) - should be consistent, preferably with a hyphen


	// LRT - 97/04/15 2:20 PM
	Localized "^0 KB" strings in picker size edit slip.
	Localized "Byten" picker label in size edit slip.
	Bug:
		1647121	- Pop-up for size uses "K" => Should be "KB"


EnRoute Rule Editor 1.4.1a7
EnRoute Regel-Editor 1.4.1a7 D

	// LRT - 97/04/11 1:08 AM
	Fixed problem with German decimal place being ignored.
	Bug:
		1646672 - decimal number not saved upon closing/opening size filter

		size entry line function "textChanged"

			Changed StringFilter parameter from the English-Only
				".0123456789"
			to the correctly localized
				GetLocale().numberformat.decimalpoint & "0123456789";


	// LRT - 97/04/11 2:28 AM
	Added "autoPutawayEnabled" slot set to true.
	Bug:
		1644952 - item not put away although "Put away automatically" checked


	// LRT - 97/04/11 1:44 AM
	Added a nil exception handler around the code which evaluates the entered
	text to prevent the reported exception.
	Bug:
		1646668 - (-48404) when entering number w/ point as decimal separator

		size entry line function "textChanged"

			...
			try
			...
			onexception |evt.ex| do nil;
			...

Message Size Filter 1.4.1a7  (English Size Filter Plugin)
i-net Grenfilter 1.4.1a7 <D>  (German Size Filter Plugin)

	// LRT - 97/04/11 12:53 AM
	The message size entry line was written with the mistaken assumption
	that users would understand that "4 K" meant 4096 bytes, "1 M" meant
	one megabyte, and that (by inference) "512" would simply mean 512 bytes.

	To address this oversight, the size entry line will now display the
	localized suffix "bytes" when showing sizes smaller than 1K.

	The bug report was the result of this misunderstanding. Entering the
	text "32" will result in messages larger than 32 bytes to be skipped,
	not messages larger than 32 K!
	Bug:
		1646310 - mail not downloaded if number entered without "KB" (K in English)

		size entry line function function "ShortestSize"

			// WAS:
			//s := SPrintObject ( RIntToL(size) );
			// NEW:
			s := ParamStr ( LocObj ( "^0 bytes", 'sizeFilter.dispAs_Bytes ),
				[ SPrintObject ( RIntToL(size) ) ] );


	// LRT - 97/04/11 1:44 AM
	Added a nil exception handler around the code which evaluates the entered
	text to prevent the reported exception.
	Bug:
		1646285 - (-48404) when entering number w/ period as decimal separator

		size entry line function "textChanged"

			...
			try
			...
			onexception |evt.ex| do nil;
			...


	// LRT - 97/04/11 1:08 AM
	Fixed problem with German decimal place being ignored.
	Bug:
		1646290 - decimal number not saved upon closing/opening size filter

		size entry line function "textChanged"

			Changed StringFilter parameter from the English-Only
				".0123456789"
			to the correctly localized
				GetLocale().numberformat.decimalpoint & "0123456789";


	// LRT - 97/04/11 1:15 AM
	Added a call to RedoChildren for the "Larger than" text display
	when the "Skip messages" checkbox is checked ON
	This will allow users to more readily view the result of entering
	a new value if they are confused by the behavior of the text
	entry line.

		onOff Checkbox function "valueChanged"

			...
			sizeValue:Show();
			// allow check of box to redisplay new values
			// Helps clarify actual situation reported
			// as bug 1646310
			// - no download if number entered without "KB"
			// NEW:
			sizeValue:RedoChildren();
			...



EnRoute Regel-Editor 1.4a4 D  (German Rule Editor)

	// LRT - 97/04/03 4:06 PM
	Identifying unlocalized strings missed during first pass of
	translation to German.

	Still Needing Translation
	=========================

		ruleEd.prefNoDelete
			"The item currently set as the preference cannot be deleted."

		keyCommands:
			- a full set uf shortcuts and Help info for the Rule Editor

	Already Translated
	==================

		app.appAll
			LocObj ( "All Rule Sets", 'rulesPlugin.appAll )


	// LRT - 97/04/03 7:06 PM
	Fixed reported localization problems for "Mit Hilfe von" and "Keine".
	Bug:
		1642109 - Rules Filter translation problem



i-net Grenfilter 1.4a2 <D>  (German Size Filter Plugin)

	// LRT - 97/04/02 12:48 PM
	Removed space in the Extras label for the German size filter.
	Changed "Gren filter" to "i-net Grenfilter"
	Bug:
		1642111 - space in German extras label for size filter is wrong





============================================================================
	// LRT - 97/01/08 5:37 PM
	// WAS:
	//if IsReadOnly ( transport.prefExtns ) then
	//	transport.prefExtns := Clone ( transport.prefExtns );
	// NEW:
	if IsReadOnly ( transport.prefExtns ) then
		transport.(EnsureInternal('prefExtns)) := Clone ( transport.prefExtns );


		// LRT - 96/12/21 2:42 PM
		// Grip of death
		//transport.filterExtns := [];
		transport.(EnsureInternal('filterExtns)) := Array(0,nil);


		// LRT - 96/12/21 2:42 PM
		// Grip of death
		//transport.prefExtns := [];
		transport.(EnsureInternal('prefExtns)) := Array(0,nil);


		// LRT - 96/12/21 2:42 PM
		// Grip of death
		//transport.tscriptExtns := [];
		transport.(EnsureInternal('tscriptExtns)) := Array(0,nil);


		extendA := gEnRoute.(EnsureInternal('extended)) := Array(0,nil);


prefsV.viewSetupFormScript
	// LRT - 96/12/21 4:25 PM
	// try to provide for close to avoid Grip of death
	GetRoot().(EnsureInternal(kAppSymbol)) := self;


prefsV.viewQuitScript
	try
	...
		// LRT - 96/12/21 4:59 PM
		RemoveSlot ( GetRoot(), kAppSymbol );

		if prefsView and prefsView.openViewsA then
			begin
			try
			local ourV := LFetch ( prefsView.openViewsA, kAppSymbol, 0,
				'|=|, 'appSymbol );

			if ourV then
				begin
				if kDebugOn then print ( "Removing Ourself from openViewsA" );
				SetRemove ( prefsView.openViewsA, ourV );
				end;
			onexception |evt.ex| do nil;
		end;


	onexception |evt.ex| do nil;



xxxExtn.AttachExtension

	if not prefsView.openViewsA then
		prefsView.(EnsureInternal('openViewsA)) := [ v ];
	else
		AddArraySlot ( prefsView.openViewsA, v );



RemoveScript := func ( removeFrame )
	begin
	try
		local prefV := GetRoot().(kAppSymbol);
		if prefV and prefV.viewCObject then
			begin
			prefV:Close();
			end;
	onexception |evt.ex| do nil;
	RemoveSlot ( GetRoot(), kAppSymbol );




			pref extension frames MUST have the form:

			{
			item:		"PickListString",
			pickable:	true,
			callFunc:	func ( prefsView ),	// possible bad pkg ref!
			 - OR -
			callFunc:	'someSlotSymbol,	// LRT - 96/12/19 6:56 PM
			id:			kAppSymbol,
			} );

		try
		local aux := items[index];
		if IsFrame(aux) and aux.callFunc then
			begin
			if IsFunction(aux.callFunc) then
				call aux.callFunc with ( :Parent() );	// WAS self pre-1.4B22
			else if IsSymbol ( aux.callFunc )
			or ClassOf(aux.callFunc) = 'pathExpr then
				begin
				local rootFrame := GetRoot().(aux.id)
				if rootFrame then
					call rootFrame.(aux.callFunc) with ( :Parent() );
				end;
			end;
		onexception |evt.ex| do nil;

AttachExtension:

	local thisExtn := EnsureInternal (
		{
		item:		"Size Filter",
		pickable:	true,
		id:			kAppSymbol,
		//_proto:	{},				// LRT - 96/12/19 3:56 AM
		_proto:
			{
			callFunc:	nil,
			},
		} );


AttachFilterExtn:

	// prevent bad package refs during "RemoveScript"
	thisFilter._proto._proto := GetLayout ( "sizeFilter" );
	***********************************************

	// LRT - 96/12/19 7:19 PM
	// Now using the new logic of Plugin 2.x root frame extensions
	// which are being added to further reduce bad pkg ref errors

	local thisFilter := EnsureInternal (
		{
		id:			kAppSymbol,
	//	precedence:	0,
		} );



CORE:FilterRead();

		// LRT - 96/12/19 7:01 PM
		// new logic can handle case of Plugin 2.x root frame extensions
		// which are being added to further reduce bad pkg ref errors
		local specProto := fSpec;
		if not HasSlot (fSpec, '_proto ) then
			specProto := GetRoot().(fSpec.id);
		if specProto and specProto.Filter then
			begin
			local ff := {
				_parent:	self,
				_proto:		specProto,	// WAS: fSpec,
				synop:		{},
				msg:		{},
				};


==== TRANSPORT ================================================================
	if transport.rxExtns
	and Length ( transport.rxExtns ) > 0 then
		begin
		local result;
		local extn;
		foreach extn in transport.rxExtns do
			begin
			local xf := {
				_parent:	self,
				_proto:		extn,
				};
			try result := xf:?XExtractPart ( theTxt, boundary, k_InterpHeadersFunc );
			onexception |evt.ex| do result := nil;
			if result then return result;
			end;
		end;

==== TRANSPORT ================================================================
	if transport.txExtns
	and Length ( transport.txExtns ) > 0 then
		begin
		local extn;
		foreach extn in transport.txExtns do
			begin
			local moreToAdd;
			local xf := {
				_parent:	self,
				_proto:		extn,
				};
			try moreToAdd := xf:?XAppendForBody ( currentItem );
			onexception |evt.ex| do moreToAdd := nil;
			if StrFilled ( moreToAdd ) then
				begin
				try
					call funcEnsure2CRs with ( bodyText );
					call funcSMungeAppend with ( bodyText, moreToAdd );
				onexception |evt.ex| do
					begin
					if kDebugOn then printdepth := 3;
					if kDebugOn then print ( "An error occurred appending XAppendForBody" );
					if kDebugOn then write ( "CurrentException: " );
					if kDebugOn then print ( CurrentException() );
					if kDebugOn then printdepth := 0;
					end;
				end;
			end;
		end;

==== CORE ================================================================
ItemCompleted:
	try
		begin
		if transport exists and transport.rxExtns
		and Length ( transport.rxExtns ) > 0 then
			begin
			local extn;
			foreach extn in transport.rxExtns do
				begin
				local xf := {
					_parent:	self,
					_proto:		extn,
					};
					xf:?XPreItemCompleted ( item, st, err );
				end;
			end;
		end;
	onexception |evt.ex| do nil;

	inherited:ItemCompleted ( item, state, err );

==== CORE ================================================================
GetTransportScripts:
	if tscriptExtns
	and Length ( tscriptExtns ) > 0 then
		begin
		local extn;
		foreach extn in tscriptExtns do
			begin
			try
				begin
				local xf := {
					_parent:	self,
					_proto:		extn,
					};

				local newTSA := xf:?XGetTScripts ( item );
				if newTSA then
					begin
					if IsFrame(newTSA) then newTSA := [newTSA];
					local newScript;
					foreach newScript in newTSA do
						begin
						AddArraySlot ( scripts, newScript );
						end;
					end;
				end;
			onexception |evt.ex| do nil;
			end;
		end;

==== CORE ================================================================
FilterRead:
	foreach fSpec in transport.filterExtns do
		if not fSpec.precedence then
			fSpec.(EnsureInternal('precedence)) := 0;

	Sort ( transport.filterExtns, '|<|, 'precedence );
	onexception |evt.ex| do nil;

	local action;
	try
	foreach fSpec in transport.filterExtns do
		begin
		// LRT - 96/12/19 7:01 PM
		// new logic can handle case of Plugin 2.x root frame extensions
		// which are being added to further reduce bad pkg ref errors
		local specProto := fSpec;
		if not HasSlot (fSpec, '_proto ) then
			specProto := GetRoot().(fSpec.id);
		if specProto and specProto.Filter then
			begin
			local ff := {
				_parent:	self,
				_proto:		specProto,	// WAS: fSpec,
				synop:		{},
				msg:		{},
				};
			if synop then ff.synop := synop;
			if msg   then ff.msg   := msg;

			if ( action := ff:Filter() ) then
				break;
			end;
		end;
	onexception |evt.ex| do
		action := nil;

	action;

==== CORE ================================================================
	GenInfoAuxItems: func()
		begin
		// LRT - 96/12/19 6:48 PM
		// there was a problem here with invalid package refs which
		// I'm trying to solve by removing all direct references
		// from the arrays in the transport
		//transport.prefExtns;
		Clone(transport.prefExtns);
		end,

	DoInfoAux: func ( items, index )
		begin

			pref extension frames MUST have the form:

			{
			item:		"PickListString",
			pickable:	true,
			callFunc:	func ( prefsView ),	// possible bad pkg ref!
			 - OR -
			callFunc:	'someSlotSymbol,	// LRT - 96/12/19 6:56 PM
			id:			kAppSymbol,
			} );

		// LRT - 96/11/19 7:17 PM
		// Fixed so that we will pass the actual prefs view to
		// plugins when they are selected from [i]

		try
		local aux := items[index];
		if IsFrame(aux) and aux.callFunc then
			begin
			if IsFunction(aux.callFunc) then
				call aux.callFunc with ( :Parent() );	// WAS self pre-1.4B22
			else if IsSymbol ( aux.callFunc ) then
				begin
				local rootFrame := GetRoot().(aux.id)
				if rootFrame then
					call rootFrame.(aux.callFunc) with ( :Parent() );
				end;
			end;
		onexception |evt.ex| do nil;
		end,

**************************************************************************/